package com.blockchain.console.servlets.user;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.blockchain.console.service.financial.entity.TxglRecord;
import com.blockchain.console.service.user.UserManage;
import com.blockchain.console.service.user.entity.User;
import com.blockchain.console.service.user.entity.ZhxxEntity;
import com.blockchain.framework.http.servlet.annotation.Right;
import com.blockchain.framework.service.ServiceSession;
import com.blockchain.framework.service.query.Paging;
import com.blockchain.framework.service.query.PagingResult;
import com.blockchain.util.parser.IntegerParser;

@Right(id = "C_USER_LIST_CK", name = "用户列表-查看")
public class ViewTxjl extends AbstractUserServlet {
	private static final long serialVersionUID = 1L;

	@Override
	protected void processGet(HttpServletRequest request,
			HttpServletResponse response, ServiceSession serviceSession)
			throws Throwable {
		processPost(request, response, serviceSession);
	}

	@Override
	protected void processPost(final HttpServletRequest request,
			final HttpServletResponse response,
			final ServiceSession serviceSession) throws Throwable {
		UserManage userManage = serviceSession.getService(UserManage.class);
		int userid = IntegerParser.parse(request.getParameter("userid"));
		User user=userManage.get(userid);
		ZhxxEntity rmbZhxx=userManage.rmbZhxx(userid);
		String startRechargeTime=request.getParameter("startRechargeTime");
		String  endRechargeTime=request.getParameter("endRechargeTime");
		String  status=request.getParameter("status");
		PagingResult<TxglRecord> result = userManage.search( startRechargeTime,endRechargeTime,status,
				 new Paging() {
					@Override
					public int getSize() {
						return 10;

					}

					@Override
					public int getCurrentPage() {
						return IntegerParser.parse(request
								.getParameter(PAGING_CURRENT));

					}
				},userid);
		request.setAttribute("user", user);
		request.setAttribute("rmbZhxx", rmbZhxx);
		request.setAttribute("userid",userid);
		request.setAttribute("result",result);
		forwardView(request, response, getClass());
	}
}
